package com.blockmeta.bbs.immodule.adapter;

import androidx.annotation.Nullable;

import com.blockmeta.bbs.baselibrary.base.adapter.BaseAdapter;
import com.blockmeta.bbs.baselibrary.utils.LoadPicUtil;
import com.blockmeta.bbs.businesslibrary.widget.CircleImageView;
import com.blockmeta.bbs.immodule.R;
import com.blockmeta.bbs.immodule.corebean.Impl.IMApplicationContext;
import com.blockmeta.bbs.immodule.net.pojo.CircleMemberResponse;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * @author AirThor
 * @date 2019/3/27.
 */
public class CircleSubMemberAdapter extends BaseAdapter<CircleMemberResponse, BaseViewHolder> {

    public CircleSubMemberAdapter(int layoutResId, @Nullable List<CircleMemberResponse> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CircleMemberResponse item) {
        int positon = helper.getAdapterPosition();
        helper.setVisible(R.id.rctv_master,positon==0);
        CircleImageView circleImageView = helper.getView(R.id.iv_avatar);
        LoadPicUtil.loadWithPicasso(circleImageView, item.logo);
        String name = IMApplicationContext.getCircleDomainService()
                .getCircleRemarkName(item.getUserId(), item.chatGroupId, item.getName(), item.getRemarkName());
        helper.setText(R.id.tv_name, name);
    }
}
